package com.infore.airsupervise.other.listener;

import android.content.Context;
import android.view.View;
import android.view.animation.AnimationUtils;

import com.beardedhen.androidbootstrap.AwesomeTextView;
import com.beardedhen.androidbootstrap.api.defaults.DefaultBootstrapBrand;
import com.beardedhen.androidbootstrap.font.FontAwesome;
import com.infore.airsupervise.R;

/**
 * @features:
 * @author: WuTao
 * @date: 2017/5/12 13:45
 */
public class LayoutControl implements LayoutControlListener {
    private Context context;

    public LayoutControl(Context context) {
        this.context = context;
    }

    @Override
    public void layoutControl( boolean isShowed, View layout, AwesomeTextView arrow) {
        layout.setVisibility(isShowed ? View.GONE : View.VISIBLE);
        layout.setAnimation( AnimationUtils.
                loadAnimation(context, isShowed ? R.anim.pop_fade_out : R.anim.pop_fade_in));
        arrow.setFontAwesomeIcon(
                isShowed ? FontAwesome.FA_ANGLE_DOWN : FontAwesome.FA_ANGLE_UP);
        arrow.setBootstrapBrand(
                isShowed ? DefaultBootstrapBrand.REGULAR : DefaultBootstrapBrand.INFO);
    }
}
